<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>文字展融效果</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    .container {
      width: 300px;
      height: 300px;
      margin: 100px auto;
      /* 网关布局 */
      display: grid;
      /* 设置多少行，多少列 */
      grid-template-columns: 1fr 1fr 1fr;
      grid-template-rows: 1fr 1fr 1fr;
      gap: 5px;
      transition: .2s;
    }
    .item:nth-child(1) {
      background-color: aqua;
    }
    .item:nth-child(2) {
      background-color: #f70;
    }
    .item:nth-child(3) {
      background-color: #a2ee28;
    }
    .item:nth-child(4) {
      background-color: #084d47;
    }
    .item:nth-child(5) {
      background-color: #0de40d;
    }
    .item:nth-child(6) {
      background-color: rgb(56, 21, 212);
    }
    .item:nth-child(7) {
      background-color: #c5246f;
    }
    .item:nth-child(8) {
      background-color: #dde01b;
    }
    .item:nth-child(9) {
      background-color: #eb380b;
    }
    .container:has(.item:nth-child(1):hover) {
      grid-template-columns: 2fr 1fr 1fr;
      grid-template-rows: 2fr 1fr 1fr;
    }
    .container:has(.item:nth-child(2):hover) {
      grid-template-columns: 1fr 2fr 1fr;
      grid-template-rows: 2fr 1fr 1fr;
    }
    .container:has(.item:nth-child(3):hover) {
      grid-template-columns: 1fr 1fr  2fr;
      grid-template-rows: 2fr 1fr 1fr;
    }
    .container:has(.item:nth-child(4):hover) {
      grid-template-columns: 2fr 1fr 1fr;
      grid-template-rows: 1fr 2fr 1fr;
    }
    .container:has(.item:nth-child(5):hover) {
      grid-template-columns: 1fr 2fr 1fr;
      grid-template-rows: 1fr 2fr 1fr;
    }
    .container:has(.item:nth-child(6):hover) {
      grid-template-columns: 1fr 1fr 2fr;
      grid-template-rows: 1fr 2fr 1fr;
    }
    .container:has(.item:nth-child(7):hover) {
      grid-template-columns: 2fr 1fr 1fr;
      grid-template-rows: 1fr 1fr 2fr;
    }
    .container:has(.item:nth-child(8):hover) {
      grid-template-columns: 1fr 2fr 1fr;
      grid-template-rows: 1fr 1fr 2fr;
    }
    .container:has(.item:nth-child(9):hover) {
      grid-template-columns: 1fr 1fr 2fr;
      grid-template-rows: 1fr 1fr 2fr;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
</body>
</html>